﻿<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="Shortcut Icon" href="../images/aecc.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="../StaticFiles/element-ui/element-ui.css">
  <link rel="stylesheet" href="../StaticFiles/nprogress/nprogress.min.css">
  <link rel="stylesheet" href="../styles/vue-page-common.css">
  <link rel="stylesheet" href="../styles/table-transparent.css">
  <script src="../Scripts/vue.min.js"></script>
  <script src="../StaticFiles/element-ui/element-ui.js"></script>
  <script src="../Scripts/axios.min.js"></script>
  <script src="../StaticFiles/nprogress/nprogress.min.js"></script>
  <script src="../Scripts/crypto-js.js"></script>
  <script src="../Scripts/secret.js"></script>
  <script src="../Scripts/dayjs.min.js"></script>
  <script src="../Scripts/axios.config.js"></script>
  <script src="../Scripts/datav.min.vue.js"></script>
  <script src="../Scripts/lodash.min.js"></script>
  <title>生产计划看板v2.0</title>
  <style>
    html {
      background-image: url(../images/bg.jpg);
      color: #fff;
    }

    .header-title {
      font-size: 24px !important;
    }

    #queryZone .el-form-item__label {
      color: #fff;
    }
  </style>
</head>

<body>
  <div id="app" v-cloak>
    <div style="padding:0 5px;">
      <el-row>
        <el-col :span="6"><img src="../images/aeec_logo.png" height="60" alt="黎阳LOGO" /></el-col>
        <el-col :span="12" class="header-title">{{queryInfo.factoryname}}生产计划看板v2.0</el-col>
        <el-col :span="6" class="currentTime">{{currentTime}}</el-col>
      </el-row>

      <!-- 查询条件区 -->
      <el-form :inline="true" :model="queryInfo" id="queryZone" ref="queryInfoRef" :label-position="'left'"
        :rules="rules">
        <el-form-item label="筛选时间:" prop="selectdate">
          <el-date-picker v-model="queryInfo.selectdate" type="daterange" range-separator="至" value-format="yyyy-MM-dd"
            start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>

        <el-form-item label="周计划时间:" prop="weekplanfinishdate">
          <el-date-picker v-model="queryInfo.weekplanfinishdate" type="daterange" range-separator="至"
            value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="weekShortCuts">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="主制工区:">
          <el-select v-model="queryInfo.workcenterid" placeholder="请选择" clearable filterable>
            <el-option v-for="item in workcenterList" :key="item.workcenterid" :label="item.workcentername"
              :value="item.workcenterid">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="订单类型:">
          <el-select v-model="queryInfo.ordertype" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'临时'" :label="'临时'" :value="'临时'"></el-option>
            <el-option :key="'品种'" :label="'品种'" :value="'品种'"></el-option>
            <el-option :key="'预品种'" :label="'预品种'" :value="'预品种'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="计划类型:">
          <el-select v-model="queryInfo.plantype" placeholder="请选择" clearable filterable style="width: 90px;">
            <el-option :key="'初制'" :label="'初制'" :value="'初制'"></el-option>
            <el-option :key="'复制'" :label="'复制'" :value="'复制'"></el-option>
            <el-option :key="'修理'" :label="'修理'" :value="'修理'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否超期:">
          <el-select v-model="queryInfo.isdelay" placeholder="请选择" clearable filterable style="width: 90px;">
            <el-option :key="'是'" :label="'是'" :value="'是'"></el-option>
            <el-option :key="'否'" :label="'否'" :value="'否'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否跳序:">
          <el-select v-model="queryInfo.isskip" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'是'" :label="'是'" :value="'是'"></el-option>
            <el-option :key="'否'" :label="'否'" :value="'否'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="状态:">
          <el-select v-model="queryInfo.status" placeholder="请选择" clearable filterable style="width: 110px;">
            <el-option :key="'完工入库'" :label="'完工入库'" :value="'完工入库'"></el-option>
            <el-option :key="'待检验'" :label="'待检验'" :value="'待检验'"></el-option>
            <el-option :key="'待报工'" :label="'待报工'" :value="'待报工'"></el-option>
            <el-option :key="'待派工'" :label="'待派工'" :value="'待派工'"></el-option>
            <el-option :key="'已外委'" :label="'已外委'" :value="'已外委'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="零件号:" prop='productname'>
          <el-autocomplete v-model.trim="queryInfo.productname" placeholder="请输入零件号" :trigger-on-focus="false"
            style="width:190px;" :fetch-suggestions="searchProductAsync" :value-key="'productname'" :debounce="500">
          </el-autocomplete>
        </el-form-item>

        <el-form-item label="批次号:" prop='containername'>
          <el-autocomplete v-model.trim="queryInfo.containername" placeholder="请输入批次号" :trigger-on-focus="false"
            style="width:220px;" :fetch-suggestions="searchTopContainernameAsync" :value-key="'containername'"
            :debounce="500">
          </el-autocomplete>
        </el-form-item>

        <el-form-item label="重要程度:">
          <el-input v-model.trim="queryInfo.priority" placeholder="请输入" clearable style="width: 100px;"></el-input>
        </el-form-item>

        <el-form-item label="风险等级:">
          <el-input v-model.trim="queryInfo.risklevel" placeholder="请输入" clearable style="width: 100px;"></el-input>
        </el-form-item>

        <el-form-item label="工时完成率:">
          <el-slider v-model="queryInfo.worktimerate" range :max="100" :step="5" style="width: 60px;">
          </el-slider>
        </el-form-item>

        <el-form-item>
          <el-input v-model="worktimeratelable" style="width: 100px;font-size: 12px;" :disabled="true"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="searchData">查询</el-button>
          <el-button type="primary" icon="el-icon-download" size="small" @click="exportDetail">导出</el-button>
          <el-link icon="el-icon-view" type="success" @click="containerStartInfo.dialogVisiable = true">开卡信息</el-link>
          <el-link icon="el-icon-link" type="primary" @click="open('GZUnAllSetReport.html','缺件统计报表')">缺件统计报表</el-link>
          <el-link icon="el-icon-link" type="danger" @click="open('GZSkipStepReport.html','批次未完工报表')">批次未完工报表</el-link>
        </el-form-item>
      </el-form>

      <!-- 柱状图区域 -->
      <el-row>
        <el-col :span="12" style="position:relative;">
          <div class="tooltip">
            统计说明
            <el-popover placement="top-start" title="本月计划计算规则:" width="400" trigger="hover">
              <i class="el-icon-info" slot="reference"></i>
              <p>查询【结束时间】在所选【筛选时间】范围内数据。</p>
            </el-popover>
          </div>
          <dv-border-box-11 title="本月计划" ref="thisMonthChart">
            <div style="height: 260px;padding-top: 40px;" id="thisMonthChart"></div>
          </dv-border-box-11>
        </el-col>
        <el-col :span="12" style="position:relative;">
          <div class="tooltip">
            统计说明
            <el-popover placement="top-start" title="本周计划计算规则:" width="400" trigger="hover">
              <i class="el-icon-info" slot="reference"></i>
              <p>查询【周计划完成时间】在本周数据。</p>
            </el-popover>
          </div>
          <dv-border-box-11 title="本周计划" ref="thisWeekChart">
            <div style="height: 260px;padding-top: 40px;" id="thisWeekChart"></div>
          </dv-border-box-11>
        </el-col>
      </el-row>

      <!-- 页面主表格 -->
      <dv-border-box-11 title="本月计划明细" ref="datagrid" style="position:relative;">
        <div class="tooltip">
          统计说明
          <el-popover placement="top-start" title="本月计划明细计算规则:" width="400" trigger="hover">
            <i class="el-icon-info" slot="reference"></i>
            <p>查询【结束时间】在所选【筛选时间】范围内数据。</p>
          </el-popover>
        </div>
        <div id="datagrid" style="padding: 30px;padding-top:60px;padding-bottom:10px;">
          <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
            element-loading-background="rgba(0,0,0,0.8)" :data="dataList" stripe border>
            <el-table-column type="index" width="50"></el-table-column>
            <el-table-column label="操作" width="80">
              <template slot-scope="scope">
                <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
              </template>
            </el-table-column>
            <el-table-column label="零件号" prop="productname" width="100" show-overflow-tooltip></el-table-column>
            <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip></el-table-column>
            <el-table-column label="是否入库" prop="isinstore" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                  {{scope.row.isinstore}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
              style="font-size: 10px;"></el-table-column>
            <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
            <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
                <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
                <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
                <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
                <el-tag effect="dark" v-else type="info">待派工</el-tag>
              </template>
            </el-table-column>
            <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
            <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
            <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                  {{scope.row.delaystatus}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
            <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
            <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
            <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip></el-table-column>
            <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
                </el-progress>
              </template>
            </el-table-column>
            <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <div>
                  <el-link type="danger"
                    v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                    @click="getNotFinishedChildContainer(scope.row)">
                    {{scope.row.finishinfo}}
                  </el-link>
                  <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                  {{scope.row.isallset}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <div>
                  <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">缺
                    {{scope.row.lackqty}} 件</el-link>
                  <span v-else style="color:#67c23a">0</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
              <template slot-scope="scope">
                <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
                <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
                  {{scope.row.isskip}}
                </el-tag>
              </template>
            </el-table-column>
            <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
            <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
          </el-table>
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="queryInfo.currentPage" :page-sizes="[queryInfo.pageSize,20,50,100]"
            :page-size="queryInfo.pageSize" layout="prev,pager,next,jumper,sizes,total" :total="total">
          </el-pagination>
          <el-backtop></el-backtop>
        </div>
      </dv-border-box-11>

      <!-- 本月柱状图--明细对话框 -->
      <el-dialog :title="thisMonthChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="thisMonthChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="thisMonthChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
            </template>
          </el-table-column>
          <el-table-column label="零件号" prop="productname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="是否入库" prop="isinstore" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                {{scope.row.isinstore}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
            style="font-size: 10px;"></el-table-column>
          <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effect="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                {{scope.row.delaystatus}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
          <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
              </el-progress>
            </template>
          </el-table-column>
          <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link type="danger" v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                  @click="getNotFinishedChildContainer(scope.row)">
                  {{scope.row.finishinfo}}
                </el-link>
                <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                {{scope.row.isallset}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">缺
                  {{scope.row.lackqty}} 件</el-link>
                <span v-else style="color:#67c23a">0</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
              <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
                {{scope.row.isskip}}</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
        </el-table>
        <el-pagination @current-change="handleThisMonthChartDetailCurrentChange"
          :current-page="thisMonthChartDetail.queryInfo.currentPage"
          :page-sizes="[thisMonthChartDetail.queryInfo.pageSize]" :page-size="thisMonthChartDetail.queryInfo.pageSize"
          layout="prev,pager,next,jumper,sizes,total" :total="thisMonthChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 本周柱状图--明细对话框 -->
      <el-dialog :title="thisWeekChartDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="thisWeekChartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="thisWeekChartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
            </template>
          </el-table-column>
          <el-table-column label="零件号" prop="productname" width="120" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件/批次号" prop="containername" width="200" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="是否入库" prop="isinstore" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                {{scope.row.isinstore}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
            style="font-size: 10px;"></el-table-column>
          <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effect="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="周计划完成时间" prop="weekplanfinishdate" width="100" :formatter="splitDate">
          </el-table-column>
          <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                {{scope.row.delaystatus}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
          <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
              </el-progress>
            </template>
          </el-table-column>
          <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link type="danger" v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                  @click="getNotFinishedChildContainer(scope.row)">
                  {{scope.row.finishinfo}}
                </el-link>
                <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                {{scope.row.isallset}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <div>
                <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">缺
                  {{scope.row.lackqty}} 件</el-link>
                <span v-else style="color:#67c23a">0</span>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
              <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
                {{scope.row.isskip}}</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
        </el-table>
        <el-pagination @current-change="handleThisWeekChartDetailCurrentChange"
          :current-page="thisWeekChartDetail.queryInfo.currentPage"
          :page-sizes="[thisWeekChartDetail.queryInfo.pageSize]" :page-size="thisWeekChartDetail.queryInfo.pageSize"
          layout="prev,pager,next,jumper,sizes,total" :total="thisWeekChartDetail.total">
        </el-pagination>
      </el-dialog>

      <!-- 子零件批次 -->
      <el-dialog :title="childContainerDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="childContainerDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="childContainerDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="操作" width="100">
            <template slot-scope="scope">
              <el-link type="primary" @click='showChildContainerSpec(scope.row)'>查看各工序</el-link>
            </template>
          </el-table-column>
          <el-table-column label="零件号" prop="productname" width="160" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="是否入库" prop="isinstore" width="56" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
                {{scope.row.isinstore}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip
            style="font-size: 10px;"></el-table-column>
          <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effect="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
                {{scope.row.delaystatus}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
          <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
          </el-table-column>
          <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
              </el-progress>
            </template>
          </el-table-column>
          <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
                {{scope.row.isallset}}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
              <el-tag effect="dark" v-else type="danger" style="cursor:pointer;"
                @click="getChildContainerSkipInfo(scope.row)">
                {{scope.row.isskip}}</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
        </el-table>
      </el-dialog>

      <!-- 子零件批次工序 -->
      <el-dialog :title="childContainerSpecDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
        :visible.sync="childContainerSpecDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="childContainerSpecDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="批次号" prop="containername" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次数量" prop="qty" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序" prop="workflowstepname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="单位工时" prop="durationperunit" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="派工人" prop="dispatchemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="派工时间" prop="dispatchdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="报工人" prop="reportemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="报工时间" prop="reportdate" width="160" :formatter="splitDate"></el-table-column>
          <el-table-column label="检验人" prop="checkemployeename" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="检验时间" prop="checkdate" width="160" :formatter="replaceDate"></el-table-column>
          <el-table-column label="检验类型" prop="checktype" width="90" show-overflow-tooltip>
            <template slot-scope="scope" v-if="scope.row.checktype">
              <span v-if="scope.row.checktype === 1">首件检验</span>
              <span v-else>其他检验</span>
            </template>
          </el-table-column>
          <el-table-column label="状态" prop="status" width="100" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effec="dark" v-if="scope.row.status === '已完工'" type="success">已完工</el-tag>
              <el-tag effec="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
              <el-tag effec="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
              <el-tag effec="dark" v-else-if="scope.row.status === '已外委'" type="warning">已外委</el-tag>
              <el-tag effec="dark" v-else type="info">待派工</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="是否外委" prop="isww" width="100" show-overflow-tooltip>
            <template slot-scope="scope" v-if="scope.row.isww">
              <el-tag effect="dark" v-if="scope.row.isww === '是'" type="danger">是</el-tag>
              <el-tag effect="dark" v-else>否</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>

      <!-- 缺件明细 -->
      <el-dialog :title="missingPartDetail.title" :width="'50%'" :center="'center'"
        :visible.sync="missingPartDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="missingPartDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="零件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件名称" prop="productdescription" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="是否缺件" prop="isallset" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" type="danger">是</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>

      <!-- 未完成子零件信息 -->
      <el-dialog :title="notFinishedChildContainerDetail.title" :width="'50%'" :center="'center'"
        :visible.sync="notFinishedChildContainerDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="notFinishedChildContainerDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="零件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件名称" prop="productdescription" width="200" show-overflow-tooltip></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
          <el-table-column label="是否完成" prop="isallset" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              <el-tag effect="dark" type="danger">否</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-dialog>

      <!-- 跳序信息 -->
      <el-dialog :title="skipStepDetail.title" :width="'50%'" :top="'10px'" :center="'center'"
        :visible.sync="skipStepDetail.dialogVisiable">
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="skipStepDetail.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="工序名称" prop="workflowstepname" width="120" show-overflow-tooltip></el-table-column>
        </el-table>
      </el-dialog>

      <!-- 开卡信息 -->
      <el-dialog :title="'开卡信息查询'" :width="'100%'" :top="'10px'" :center="'center'"
        :visible.sync="containerStartInfo.dialogVisiable" @close="containerStartInfoClosed"
        @opened="getContainerStartInfo">
        <el-form :inline="true" :model="containerStartInfo.queryInfo" ref="containerStartInfoRef"
          :label-position="'left'" :rules="containerStartInfo.rules">
          <el-form-item label="开卡时间:" prop="startdate">
            <el-date-picker v-model="containerStartInfo.queryInfo.startdate" type="daterange" range-separator="至"
              value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
            </el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="small" @click="getContainerStartInfo">查 询</el-button>
          </el-form-item>
        </el-form>
        <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
          element-loading-background="rgba(0,0,0,0.8)" :data="containerStartInfo.dataList" stripe border>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
          <el-table-column label="数量" prop="qty" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="主制工区" prop="fromworkcentername" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件图号" prop="productname" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="零件名称" prop="productdescription" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="当前工序" prop="workflowstepname" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="开卡人" prop="fullname" width="80" show-overflow-tooltip></el-table-column>
          <el-table-column label="开卡时间" prop="originalstartdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="品种类型" prop="ordertype" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="计划类型" prop="plantype" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="开始日期" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="结束日期" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
          <el-table-column label="重要等级" prop="priority" width="100" show-overflow-tooltip></el-table-column>
          <el-table-column label="风险程度" prop="risklevel" width="100" show-overflow-tooltip></el-table-column>
        </el-table>
        <el-pagination @current-change="handleContainerStartInfoCurrentChange"
          :current-page="containerStartInfo.queryInfo.currentPage" :page-size="containerStartInfo.queryInfo.pageSize"
          :page-sizes="[containerStartInfo.queryInfo.pageSize]" layout="prev,pager,next,jumper,sizes,total"
          :total="containerStartInfo.total">
        </el-pagination>
      </el-dialog>
    </div>
  </div>
  <script src="../Scripts/echarts/echarts-5.4.0.min.js"></script>
  <script type="module">
    import { barOption, colorList } from '../Scripts/hooks/chartConfig.js'
    import { exportExcelData, getParams, fetchSuggestion } from '../Scripts/hooks/useCommonMethod.js'
    import { prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth } from '../Scripts/hooks/useDateShortCut.js'
    import { getFactoryInfo, getWorkcenterList } from '../Scripts/hooks/fetchAPI.js';
    import { splitDate, replaceDate } from '../Scripts/hooks/format.js'
    const app = new Vue({
      el: '#app',
      data: {
        splitDate, replaceDate,
        currentTime: '',
        total: 0,
        loading: false,
        loadingText: '数据加载中...',
        thisweek: '',
        queryInfo: {
          factoryid: '',
          factoryname: '',
          selectdate: '',//筛选时间
          weekplanfinishdate: '',
          workcenterid: '',//主制工区
          ordertype: '',//订单类型
          plantype: '',//计划类型
          isdelay: '',//是否超期
          isskip: '',//是否跳序
          status: '',//完工状态
          productname: '',//零件号
          containername: '',//顶层批次号
          priority: '',//重要程度
          risklevel: '',//风险等级
          worktimerate: [0, 100],
          currentPage: 1,//当前页
          pageSize: 12//每页显示条数
        },
        loadingConfig: { text: '数据查询中...', effect: 'whirling', maskColor: 'transparent', textColor: '#fff' },
        rules: {
          selectdate: [{ required: true, message: '筛选时间不能为空', trigger: 'change' }],
          weekplanfinishdate: [{ required: true, message: '周计划完成时间不能为空', trigger: 'change' }]
        },
        dataList: [],
        workcenterList: [],
        pickerOptions: { shortcuts: [prevMonth, thisMonth] },
        weekShortCuts: { shortcuts: [prevWeek, thisWeek, nextWeek] },
        // 本月明细
        thisMonthChartDetail: {
          dialogVisiable: false,
          queryInfo: { seriesName: '', workcentername: '', currentPage: 1, pageSize: 12 },
          dataList: [], title: '', total: 0
        },
        // 本周明细
        thisWeekChartDetail: {
          dialogVisiable: false,
          queryInfo: { seriesName: '', workcentername: '', currentPage: 1, pageSize: 12 },
          dataList: [], title: '', total: 0
        },
        // 子零件批次
        childContainerDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 子零件批次工序
        childContainerSpecDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 缺件明细
        missingPartDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 未完成子零件批次信息
        notFinishedChildContainerDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 跳序信息
        skipStepDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 开卡信息
        containerStartInfo: {
          dialogVisiable: false,
          dataList: [],
          queryInfo: { startdate: '', factoryname: '工装工具厂', currentPage: 1, pageSize: 12 },
          rules: { startdate: [{ required: true, message: '开卡时间不能为空', trigger: 'change' }] },
        }
      },
      methods: {
        // 查询件号
        searchProductAsync(value, callback) {
          fetchSuggestion({ actionName: 'getGZTopProductname', name: 'productname', value, callback, triggerLength: 2 })
        },
        // 查询顶层批次号
        searchTopContainernameAsync(value, callback) {
          fetchSuggestion({ actionName: 'getGZTopContainername', name: 'containername', value, callback, triggerLength: 2 })
        },
        // 本月计划--柱状图
        async getThisMonthBarChart() {
          const dom = document.getElementById("thisMonthChart");
          echarts.dispose(dom);
          let chart = echarts.init(dom);
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getThisMonthBarChart', {
            type: 'getThisMonthBarChart',
            ...this.queryInfo
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(dom);
          chart = echarts.init(dom);

          let arrWorkcenter = [], arrTotal = [], arrFinished = [];
          for (const i of data) {
            arrWorkcenter.push(i.workcentername);
            arrTotal.push(i.total);
            arrFinished.push(i.finished);
          }

          let totalSum = arrTotal.reduce((prev, cur) => prev + cur);//总套数汇总
          let finishedSum = arrFinished.reduce((prev, cur) => prev + cur);//已完成数汇总
          arrWorkcenter.unshift('工装工具厂');
          arrTotal.unshift(totalSum);
          arrFinished.unshift(finishedSum);

          let option = barOption({ isLableFormat: true, provideNumber: 4 });
          option.legend.data = ['总套数', '已完成套数'];//设置图例文字
          option.xAxis.data = arrWorkcenter;
          option.yAxis[1].show = false;

          option.series[0] = _.merge(option.series[0], {
            name: '总套数',
            data: arrTotal,
            label: { color: colorList.blue.color },
            itemStyle: { color: { colorStops: colorList.blue.colorStops } }
          });

          option.series[1] = _.merge(_.cloneDeep(option.series[0]), {
            name: '已完成套数',
            data: arrFinished,
            label: { color: colorList.green.color },
            itemStyle: { color: { colorStops: colorList.green.colorStops } }
          });
          chart.setOption(option);
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.thisMonthChart.initWH(); chart.resize(); }, 3000);

          chart.on('click', (params) => {
            const { seriesName, name, value } = params;
            if (value == 0) { return; }
            this.thisMonthChartDetail.queryInfo.seriesName = seriesName;//系列名称
            this.thisMonthChartDetail.queryInfo.workcentername = name;//工区名称
            this.thisMonthChartDetail.queryInfo.currentPage = 1;
            this.thisMonthChartDetail.title = `本月【${name}】--【${seriesName}】明细`;
            this.thisMonthChartDetail.dialogVisiable = true;
            this.getThisMonthChartDetail();
          })
        },
        // 本周计划--柱状图
        async getThisWeekBarChart() {
          const dom = document.getElementById("thisWeekChart");
          echarts.dispose(dom);
          let chart = echarts.init(dom);
          chart.showLoading(this.loadingConfig);

          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getThisWeekBarChart', {
            type: 'getThisWeekBarChart',
            ...this.queryInfo,
            selectdate: this.thisweek
          })
          chart.hideLoading();
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          if (data.length === 0) { return; }

          echarts.dispose(dom);
          chart = echarts.init(dom);

          let arrWorkcenter = [], arrTotal = [], arrFinished = [];
          for (const i of data) {
            arrWorkcenter.push(i.workcentername);
            arrTotal.push(i.total);
            arrFinished.push(i.finished);
          }

          let totalSum = arrTotal.reduce((prev, cur) => prev + cur);//总套数汇总
          let finishedSum = arrFinished.reduce((prev, cur) => prev + cur);//已完成数汇总
          arrWorkcenter.unshift('工装工具厂');
          arrTotal.unshift(totalSum);
          arrFinished.unshift(finishedSum);

          let option = barOption({ isLableFormat: true, provideNumber: 4 });
          option.legend.data = ['总套数', '已完成套数'];//设置图例文字
          option.xAxis.data = arrWorkcenter;
          option.yAxis[1].show = false;

          option.series[0] = _.merge(option.series[0], {
            name: '总套数',
            data: arrTotal,
            label: { color: colorList.blue.color },
            itemStyle: { color: { colorStops: colorList.blue.colorStops } }
          });

          option.series[1] = _.merge(_.cloneDeep(option.series[0]), {
            name: '已完成套数',
            data: arrFinished,
            label: { color: colorList.green.color },
            itemStyle: { color: { colorStops: colorList.green.colorStops } }
          });

          chart.setOption(option);
          // 解决边框组件宽高异常
          setTimeout(() => { this.$refs.thisWeekChart.initWH(); chart.resize(); }, 3000);

          chart.on('click', (params) => {
            const { seriesName, name, value } = params;
            if (value == 0) { return; }
            this.thisWeekChartDetail.queryInfo.seriesName = seriesName;//系列名称
            this.thisWeekChartDetail.queryInfo.workcentername = name;//工区名称
            this.thisWeekChartDetail.queryInfo.currentPage = 1;
            this.thisWeekChartDetail.title = `本周【${name}】--【${seriesName}】明细`;
            this.thisWeekChartDetail.dialogVisiable = true;
            this.getThisWeekChartDetail();
          })
        },
        // 表格数据
        async getData() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getData', {
            type: 'getData',
            ...this.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.dataList = data;
          this.total = total;
          this.$refs.datagrid.initWH();
        },
        // 本月明细
        async getThisMonthChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getThisMonthChartDetail', {
            type: 'getThisMonthChartDetail',
            ...this.queryInfo,
            ...this.thisMonthChartDetail.queryInfo
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.thisMonthChartDetail.dataList = data;
          this.thisMonthChartDetail.total = total;
        },
        // 本周明细
        async getThisWeekChartDetail() {
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getThisWeekChartDetail', {
            type: 'getThisWeekChartDetail',
            factoryname: this.queryInfo.factoryname,
            ...this.queryInfo,
            ...this.thisWeekChartDetail.queryInfo,
            selectdate: this.thisweek
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.thisWeekChartDetail.dataList = data;
          this.thisWeekChartDetail.total = total;
        },
        // 子零件批次
        async showChildContainer(row) {
          const { containerid, containername } = row;
          this.childContainerDetail.title = `【${containername}】明细`;
          this.childContainerDetail.dialogVisiable = true;
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getChildContainer', {
            type: 'getChildContainer',
            containerid
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.childContainerDetail.dataList = data;
        },
        // 查看子零件批次各工序
        async showChildContainerSpec(row) {
          const { containerid, containername } = row;
          this.childContainerSpecDetail.title = `【${containername}】各工序派报检明细`;
          this.childContainerSpecDetail.dialogVisiable = true;
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getChildContainerSpec', {
            type: 'getChildContainerSpec',
            containerid
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.childContainerSpecDetail.dataList = data;
        },
        // 查询缺件
        async getMissingPart(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.missingPartDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getMissingPart', {
            type: 'getMissingPart',
            containername
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.missingPartDetail.title = `【${containername}】缺件明细`;
          this.missingPartDetail.dataList = data;
        },
        // 未完成子零件
        async getNotFinishedChildContainer(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.notFinishedChildContainerDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getNotFinishedChildContainer', {
            type: 'getNotFinishedChildContainer',
            containername
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.notFinishedChildContainerDetail.title = `【${containername}】未完成子零件批次信息`;
          this.notFinishedChildContainerDetail.dataList = data;
        },
        // 查询跳序信息(根据顶层批次号)
        async getSkipStepInfo(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.skipStepDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getSkipStepInfo', {
            type: 'getSkipStepInfo',
            containername,
            factoryname: this.queryInfo.factoryname
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.skipStepDetail.title = `【${containername}】未完工工序信息`;
          this.skipStepDetail.dataList = data;
        },
        // 查询跳序信息(根据子批次号)
        async getChildContainerSkipInfo(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.skipStepDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getChildContainerSkipInfo', {
            type: 'getChildContainerSkipInfo',
            containername,
            factoryname: this.queryInfo.factoryname
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.skipStepDetail.title = `【${containername}】未完工工序信息`;
          this.skipStepDetail.dataList = data;
        },
        // 查询开卡信息
        async getContainerStartInfo() {
          this.$refs['containerStartInfoRef'].validate(async (valid) => {
            if (!valid) {
              return this.$message.error('必填项不能为空');
            }
            this.loading = true;
            this.loadingText = '数据加载中...';
            const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV2.ashx?action=getContainerStartInfo', {
              type: 'getContainerStartInfo', ...this.containerStartInfo.queryInfo
            })
            this.loading = false;
            if (meta.status === 500) { return this.$message.error(meta.msg); }
            this.containerStartInfo.dataList = data;
            this.containerStartInfo.total = total;
          });
        },
        // 开卡信息对话框关闭后
        containerStartInfoClosed() {
          this.$refs['containerStartInfoRef'].resetFields();
          this.containerStartInfo.queryInfo.currentPage = 1;
        },
        // 查询按钮点击
        searchData() {
          this.$refs['queryInfoRef'].validate(async (valid) => {
            if (!valid) { return this.$message.error('必填项不能为空'); }
            // const [start, end] = this.queryInfo.selectdate;
            // const diff = dayjs(end).diff(dayjs(start), 'day');
            // if (diff >= 31) {
            //   return this.$message.error('【筛选时间】不能超过31天');
            // }

            // const [weekStart, weekEnd] = this.queryInfo.weekplanfinishdate;;
            // const weekDays = dayjs(weekEnd).diff(dayjs(weekStart), 'day');
            // if (weekDays >= 7) {
            //   return this.$message.error('【周计划时间】不能超过7天');
            // }
            this.getThisMonthBarChart();
            this.getThisWeekBarChart();
            this.getData();
          })
        },
        handleCurrentChange(newPage) {
          this.queryInfo.currentPage = newPage;
          this.getData();
        },
        handleSizeChange(pageSize) {
          this.queryInfo.pageSize = pageSize;
          this.getData();
        },
        handleContainerStartInfoCurrentChange(newPage) {
          this.containerStartInfo.queryInfo.currentPage = newPage;
          this.getContainerStartInfo();
        },
        // 导出
        exportDetail() {
          const config = {
            url: '../handler/board/GZTaskDashBoardV2.ashx?action=exportExcel',
            data: { type: 'exportExcel', ...this.queryInfo, title: `${this.queryInfo.factoryname}生产计划看板v2.0导出` }
          }
          exportExcelData(config, this);
        },
        async open(pageurl, reportname) {
          this.$confirm(`即将跳转并打开【${reportname}】`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            const { origin, search } = window.location;
            let url = `${origin}/MESReport/Baobiao/${pageurl}${search}`;
            window.open(url);
          }).catch(() => {
            this.$message.info('取消跳转');
          });
        },
        handleThisMonthChartDetailCurrentChange(newPage) {
          this.thisMonthChartDetail.queryInfo.currentPage = newPage;
          this.getThisMonthChartDetail();
        },
        handleThisWeekChartDetailCurrentChange(newPage) {
          this.thisWeekChartDetail.queryInfo.currentPage = newPage;
          this.getThisWeekChartDetail();
        }
      },
      async mounted() {
        let incrementNumber = () => {
          setTimeout(incrementNumber, 500);
          this.currentTime = dayjs().format('YYYY年MM月DD日  HH:mm:ss');
        }
        setTimeout(incrementNumber, 500);
        const startOfThisMonth = dayjs().startOf('month').format('YYYY-MM-DD');
        const endOfThisMonth = dayjs().endOf('month').format('YYYY-MM-DD');
        const startOfThisWeek = dayjs().startOf('week').format('YYYY-MM-DD');
        const endOfThisWeek = dayjs().endOf('week').format('YYYY-MM-DD');
        this.queryInfo.selectdate = [startOfThisMonth, endOfThisMonth];
        this.queryInfo.weekplanfinishdate = [startOfThisWeek, endOfThisWeek];
        this.containerStartInfo.queryInfo.startdate = [startOfThisMonth, endOfThisMonth];
        this.thisweek = [startOfThisWeek, endOfThisWeek];

        const factoryInfo = await getFactoryInfo({ factoryid: Decrypt(getParams('factoryid')), isMapping: '是' });//查询当前分厂信息
        const { factoryid, factoryname } = factoryInfo[0];
        this.queryInfo.factoryname = factoryname;
        this.queryInfo.factoryid = factoryid;
        document.title = factoryname + '生产计划看板v2.0';

        this.workcenterList = await getWorkcenterList({
          factoryid: Decrypt(getParams('factoryid')),
          isMapping: '是',
          workcentertype: '是'
        });//获取工区列表

        this.getThisMonthBarChart();
        this.getThisWeekBarChart();
        this.getData();
      },
      computed: {
        worktimeratelable() { return `${this.queryInfo.worktimerate[0]}% ~ ${this.queryInfo.worktimerate[1]}%`; }
      }
    })
  </script>
</body>

</html>